package com.yuanian.timingwheel.test;

import com.yuanian.timingwheel.model.task.*;
import com.yuanian.timingwheel.model.timingwheel.DayTimingWheel;
import com.yuanian.timingwheel.model.timingwheel.TimingWheelTaskManager;

import java.util.Date;

public class Demo1 {

    public static void main(String[] args) {
        TimingWheelTaskManager dayTimeWheel = new TimingWheelTaskManager();
        for (int j = 0; j < 1; j++) {
            for (int i = 0; i < 1; i++) {

                //dayTimeWheel.addTask(task1);

                FixedDateTask task = new FixedDateTask("1", i, "xxx");

                try {
                    task.createTaskMethod("run", "person", null);
                    task.setTaskDesc(i + "");
                } catch (Exception e) {
                    e.printStackTrace();
                }

                AttachTask attachTask = new AttachTask("附属任务");
                try {
                    attachTask.createTaskMethod("run2", "person", null);
                    attachTask.setTaskDesc(i + "");
                } catch (Exception e) {
                    e.printStackTrace();
                }
                task.addAttachTask(attachTask);
                //task.executionTime = new Date(System.currentTimeMillis() + i * 1000);
                dayTimeWheel.saveTask(task);
            }
            //}


        }





      /*  try {
            Thread.sleep(20000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        dayTimeWheel.start();*/

    }
}
